#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>
void* my_memmove(void* dest, const void* src, size_t num)
{
	assert(dest);
	assert(src);
	void* ret = dest;
	if (dest < src || (char*)dest >= (char*)src + num)
	{
		while (num--)
		{
*(char*)dest = *(char*)src;
		dest=(char*)dest+1;
		src = (char*)src + 1;
		}
	}
	else
	{
		if (num >= 0) {
*((char*)dest+num-1) = *((char*)src+num);
		num--;
		}
		
	}


	return ret;
}


int main()
{
	int arr[] = { 1,1,2,12,2,321,1 };
	int brr[] = { 22,2,2,2,2,2 };
	my_memmove(arr, brr, 12);
	for (int i = 0; i < 7; i++)
		printf("%d ", arr[i]);
	return 0;
}